﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Connection
{
    class Program
    {
     static   MsSocketServer msServer;
        static void Main(string[] args)
        {
             msServer = new MsSocketServer("127.0.0.1",8080,2);
            msServer.ReciveEvent += ReciveDelegate;
            msServer.ClientOlinEvent += ClientOlineDelegate;
            msServer.Start();
            if (msServer.IsOpen)
            {
                if (msServer.IsConnected(null, "8081",IpDefault:true))
                {
                    msServer.SendMessage(null, "8081","123", IpDefault: true);
                }
            }
            Console.ReadLine();  
        }
        public static void ReciveDelegate(string ClientPort, string ReciveMessage)
        {
            Console.WriteLine(ClientPort+ ":"+ReciveMessage);
        }
        public static void ClientOlineDelegate(List<string> ClientListKey)
        {
            if (msServer.IsConnected(null, "8081", IpDefault: true))
            {

            }
        }
    }
}
